<table id="organTable" style="height:100%;" data-options="">
					</table>
					<script>
					
						function lookInfo(ids){
							loadViewDialog('查看信息', 'organization/lookUserInfo?ids=' + ids);
						}
						//初始化机构列表
						function initOrganTable(curNode){
							var title = curNode.name;
							var param = {
										'_query.parentIds': curNode.id
									};
							$.post("${cxt!}/common/getOrganLevelInfo", {'ids':curNode.levelIds}, function(result) {
								if(result){
									$('#organTable').datagrid({
										cls: "theme-datagrid",
										title: title,
										singleSelect: true,
										rownumbers: true, //显示序号
										pagination: true,
										pageSize: 10,
										url: "organization/organList",
										queryParams: param,
									    method: 'post',
										collapsible: true,
										columns:[[
										  		{field:'ids',title:'ids',width:100,align:'center', hidden:true},
										  		{field:'name',title:result.name,width:100,align:'center'},
										  		{field:'agentids',title:'agentids',width:100, align:'center', hidden:true},
										  		{field:'agentname',title:result.mangername,width:80, align:'center',
										  			formatter: function(value,row,index){
										  				var ids = row.agentids;
														return '<a href="#" style="color: blue;" class="button-edit" onclick="lookInfo(\'' + ids + '\')">' + value + '</a>';
													}
										  		},
										  		//{field:'agentmobile',title:result.mangerphone,width:160, align:'center'},
										  		{field:'mangerids',title:'mangerids',width:100, align:'center', hidden:true},
										  		{field:'mangername',title:result.parentmanger,width:80, align:'center',
										  			formatter: function(value,row,index){
										  				var ids = row.mangerids;
														return '<a href="#" style="color: blue;" class="button-edit" onclick="lookInfo(\'' + ids + '\')">' + value + '</a>';
													}
										  		},
										  		//{field:'mangermobile',title:result.parentmanger+'手机号',width:160, align:'center'},
										  		{field:'kytime',title:result.time,width:120, align:'center'}
										      ]],
										onLoadSuccess:function(){
											$('#organTable').datagrid("selectRow", 0);
											// 获取主表选中行
								        	var gridSelectRow = $("#organTable").datagrid('getSelected');
								        	initOrganUserTable(gridSelectRow.ids, gridSelectRow.name);
										},
										onClickRow:function(rowIndex,rowData){
											initOrganUserTable(rowData.ids, rowData.name);
										}
									});
								}else{
									$('#organTable').datagrid({
										cls: "theme-datagrid",
										title: title,
										rownumbers: false,
										columns:[[]],
										onLoadSuccess:function(){
											initOrganUserTable(curNode.id, curNode.name);
										}
									});
									
								}
								
							}, 'json');
							
						}
						//初始化机构用户列表 row为选中行
						function initOrganUserTable(ids,name){
							var childGridId = "${childGridId}";
							var $childGrid = $("#" + childGridId);
							if (typeof(ids) == "undefined") { 
				        		$childGrid.datagrid({ 
				        			cls: "theme-datagrid",
				        			rownumbers: false,
									title: " ",
									columns:[[]]
				        		});
				        	}else{
					        	$childGrid.datagrid({
									cls: "theme-datagrid",
									title: name,
									singleSelect: true,
									rownumbers: true, //显示序号
									pagination: true,
									pageSize: 10,
									url: "organization/organUserList",
									queryParams: {
										'_query.organizationids': ids
									},
								    method: 'post',
									collapsible: true,
									columns:[[
									  		{field:'ids',title:'ids',width:100,align:'center', hidden:true},
									  		{field:'name',title:'姓名',width:100,align:'center'},
									  		//{field:'username',title:'用户名',width:100, align:'center'},
									  		{field:'stationname',title:'岗位',width:80, align:'center'},
									  		//{field:'mobile',title:'电话',width:160, align:'center'}
									      ]]
								});
				        	}
						}
					</script>